package com.oracle.application.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.oracle.application.entity.Phone;
import com.oracle.application.entity.vo.PhoneVo;
import com.oracle.application.entity.vo.R;
import com.oracle.application.mapper.PhoneMapper;
import com.oracle.application.service.IPhoneService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zjc
 * @since 2021-07-06
 */
@Service
public class PhoneServiceImpl extends ServiceImpl<PhoneMapper, Phone> implements IPhoneService {

    @Autowired(required = false)
    private PhoneMapper phoneMapper;

    @Override
    public void updatePhoneId(Integer id) {
        this.phoneMapper.updatePhoneId(id);
    }

    @Override
    public R<Page> pageIphone(Integer current, Integer pageSize,PhoneVo phoneVo) {
        Page page = new Page(current,pageSize);

        QueryWrapper queryWrapper = new QueryWrapper(phoneVo);
        Page pages = this.phoneMapper.selectMapsPage(page,queryWrapper);
        return new R<Page>(200,"ok",pages);
    }
}
